public class test1 {
    public static void main(String[] args) {

        //int转字符串
        int a = 12345;
        String str1 = a+"";
        String str2 = String.valueOf(a);

        System.out.println(str1);
        System.out.println(str2);

        //字符串转int
        String str3 = "100";
        int num = Integer.parseInt(str3);

        System.out.println(num+1);
    }

    public static void main16(String[] args) {
        String str1 = "hello";
        String str2 = "world";
        System.out.println(str1+" "+str2);
        //int 转 String
        int a = 10;
        int b = 20;
        System.out.println("a = "+a);
        System.out.println("b = "+b);

        System.out.println("a+b= "+a+b);//字符串在前
        System.out.println(a+b+" = a+b");//int在前，先计算a+b，再转为字符串
        System.out.println("a+b= "+(a+b));//加括号先计算
    }

    public static void main15(String[] args) {
        short a =128;
        byte b =(byte) a;
        System.out.println(a);
        System.out.println(b);
    }

    public static void main14(String[] args) {
        int i = 20;
        float f = 12.5f;
        f = i;
        System.out.println(i);
        System.out.println(f);
    }

    public static void main13(String[] args) {
        int i = 20;
        float f = 12.5f;
        i = (int)f;//隐式转换
        System.out.println(i);
        System.out.println(f);
    }


    public static void main12(String[] args) {
        int a = 10;
        long b = 20L;
        a = (int)b;//强制类型转换  有一定风险
        System.out.println(a);
        System.out.println(b);
    }

    public static void main11(String[] args) {
        //boolean 没有明确的大小
        //boolean flg = 1   // error  也不能强转
        boolean flg = true;
        System.out.println(flg);
    }

    public static void main10(String[] args) {
        //两个字节
        char ch1 = '6';
        System.out.println(ch1);
        char ch2 = '哈';
        System.out.println(ch2);
        char ch3 = 24567;
        System.out.println(ch3);

        System.out.println(Character.MIN_VALUE + 1);//1
        System.out.println(Character.MAX_VALUE - 1);//65534
    }

    public static void main9(String[] args) {
        //四个字节
        float f = 12.5f;//必须加f/F，默认是double
        System.out.println(f);//12.5
    }

    public static void main8(String[] args) {
        double d = 12.500;
        System.out.println(d);//12.5

        double num = 1.1;
        System.out.println(num*num);//1.2100000000000002
    }

    public static void main7(String[] args) {
        int a = 1;
        int b = 2;
        System.out.println(a/b);//0
    }

    public static void main6(String[] args) {
        //8个字节
        double d = 12.5;
        System.out.println(d);
        System.out.println(Double.MIN_VALUE);
        System.out.println(Double.MAX_VALUE);
    }

    public static void main5(String[] args) {
        //1个字节
        byte a = 10;
        System.out.println(a);
        System.out.println(Byte.MIN_VALUE);
        System.out.println(Byte.MAX_VALUE);
    }

    public static void main4(String[] args) {
        //2个字节
        short a = 10;
        System.out.println(a);
        System.out.println(Short.MIN_VALUE);
        System.out.println(Short.MAX_VALUE);
    }

    public static void main3(String[] args) {
        //8个字节
        long a = 10L;//L可加可不加，大小写都行，建议大写
        System.out.println(a);
        System.out.println(Long.MAX_VALUE);
        System.out.println(Long.MIN_VALUE);
    }

    public static void main2(String[] args) {
        //4个字节
        int a = 10;
        System.out.println(a);
        System.out.println(Integer.MAX_VALUE);
        System.out.println(Integer.MIN_VALUE);
    }

    public static void main1(String[] args) {
        System.out.println("hello world");

    }
}
